﻿@using Microsoft.AspNetCore.Components.Forms

@inject NavigationManager NavigationManager

<h3>NavigateOnSubmit</h3>

<EditForm Model="@this" OnValidSubmit="NavigateToPage">
    <input @onblur="HandleBlur" id="text-input"/>
</EditForm>

@code {
    public string Name { get; set; }

    public void NavigateToPage()
    {
        // The purpose of this test case is to show that the @onblur handler doesn't interfere with
        // navigating to another page (https://github.com/dotnet/aspnetcore/issues/21241). We're doing
        // a force-load here because the E2E test script wants to verify that the server-side navigation
        // doesn't get blocked by the presence of the @onblur handler.
        NavigationManager.NavigateTo("/subdir", true);
    }

    public void HandleBlur()
    {
        Console.WriteLine("Inside HandleBlur...");
    }

}
